package com.czk.model.combile.prictice;

/**
 * 顶层接口设置为抽象类
 * @Author:ChenZhangKun
 * @Date: 2020/7/29 22:30
 */
public abstract class Person {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    // 定义添加方法
    protected  void add(Person person){
        // z默认实现
        throw new UnsupportedOperationException();
    };
    // 定义遍历方法
    protected  abstract void print();

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
